﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using FluentValidation.Attributes;
using Home.Domain.Entities.Example;
using Home.Domain.Entities.Secondary.Validation;
using Utilities.ViewModel;
using FluentValidation;
namespace Home.WebUI.Areas.Example.Validation
{
    #region 创建
    [Validator(typeof(VCareerCreateValidator))]
    public class VUserInfoCreate : UserInfo
    {
        /// <summary>
        /// 确认密码
        /// </summary>
        public string VPassWord { get; set; }
        /// <summary>
        /// 映射前赋值，调用此方法赋值不许映射值为null，以及其他值
        /// </summary>
        public void Map()
        {
            this.CreateDate = null;
            this.Ip = null;
        }
    }
    /// <summary>
    /// 验证类
    /// </summary>
    public class VUserInfoCreateValidator : TPCUserInfoValidator<VUserInfoCreate>
    {

        public VUserInfoCreateValidator()
        {
            RuleFor(u => u.VPassWord).Equal(u => u.PassWord).WithMessage("和密码不同");
        }
    }
    #endregion 
}